// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   BalanceAction.java

package com.boci.clientapp.balance.action;

import com.boci.clientapp.balance.BalanceScrPanel;
import com.boci.clientapp.balance.handler.BalanceHandler;
import com.boci.clientapp.balance.vo.BalanceVO;
import com.boci.clientapp.main.ApplicationService;
import com.boci.clientapp.main.MainPanel;
import com.boci.common.action.AbstractAction;
import com.boci.common.constant.RequestTypeConst;
import com.boci.common.handler.StaticConnectionParam;
import com.boci.common.util.AppException;
import com.boci.common.util.StringUtil;
import java.util.HashMap;
import java.util.logging.Logger;

public class BalanceAction extends AbstractAction
{

    public BalanceAction()
    {
        strModName = "Balance module";
        strScrName = "Balance screen";
    }

    private void addExtraValues(HashMap pInpMap)
    {
        pInpMap.put("Submit", "Submit");
        pInpMap.put("channel", "TRADEXPRESS");
    }

    public void doProcess(HashMap pInpMap, String pActionType)
    {
    	BalanceScrPanel balancePanel;
	    balancePanel = (BalanceScrPanel)appServ.getMainPanel().getPanel(strModName, strScrName);
	    if(appServ == null)
	        return;
	    try{
	        appServ.setBusy(true);
	        if(pActionType.equals("GO"))
	        {
	            String strReqType = RequestTypeConst.BOCI_BALANCE_URL;
	            String selectAcct = (String)pInpMap.get("selectAcct");
	            String encPasswd = StaticConnectionParam.getInstance().getStrEncPass();
	            String selectCurrency = (String)pInpMap.get("selectCurrency");
	            addExtraValues(pInpMap);
	            BalanceHandler balanceHandler = new BalanceHandler(strReqType);
	            BalanceVO balanceVO = (BalanceVO)balanceHandler.getBalance(pInpMap);
	            balancePanel.refresh(balanceVO);
	        }
    	}catch(AppException appEx){
            balancePanel.refresh(null);
            if(appEx.getReturnCode().equals("4"))
            {
                appServ.showInfoDialog(null, appEx.getMessage());
                appServ.showChgPassDialog(true);
            } else
            {
                appServ.showErrorDialog(null, appEx.getMessage());
            }
    	}catch(Exception sysEx){
            logger.severe(StringUtil.formatException(sysEx));
            appServ.showSysErrDialog();   		
    	}finally{
    		appServ.setBusy(false);
    	}
    	return;
    }

    String strModName;
    String strScrName;
}
